package edu.ccut.saturn.basevalidate.prvalidate;

import java.util.Date;

import edu.ccut.saturn.component.DateFormatManager;
import edu.ccut.saturn.component.DefaultSaturnValidate;
import edu.ccut.saturn.component.ValidateResult;

public class isDateValidate extends DefaultSaturnValidate {

	public void doValidate(Object value, Object[] args, ValidateResult result) {
		//if (args == null) {
			try {
				Date date = DateFormatManager.getDate(value.toString());
				if(date == null) {
					sendError(_ERROR_, value, result);
				}
			} catch (Exception e) {
				sendError(_ERROR_, value, result);
			}
			
		//	return;
	//	}
		
		
   /*     //TODO:对输入的格式是否需要校验？
		if (args[0] == null || args.length == 0) {
			sendError(_ARGERROR_, value, result);
			return;
		}

		try {
			Date date = DateFormatManager.getDate(value.toString(), args[0]
					.toString());
			
			if(date == null) {
				sendError(_ERROR_, value, result);
			}
		} catch (Exception e) {
			sendError(_ERROR_, value, result);
		}*/
	}
}
